package com.cepri.service.yingxiao;

import android.content.Context;
import android.content.Intent;

import com.cepri.service.zxing.CaptureActivity;

/**
 * 描 述：本地扫码
 * 作 者：wgz  2020/9/13 14:36
 * 修改描述：
 * 修 改 人： 王贵重  2020/9/13 14:36
 * 修改版本： 1.0
 */
public class ZxingManager {
    private OnScanClickListener callBack;
    private Context mContext;

    private static class ZxingManagerHolder {
        static final ZxingManager INSTANCE = new ZxingManager();
    }

    /**
     * 获取单例对象
     *
     * @return
     */
    public static ZxingManager getInstance() {
        return ZxingManager.ZxingManagerHolder.INSTANCE;
    }

    public void init(Context context){
        this.mContext = context;
    }

    public void toIntent(Context context, OnScanClickListener callBack){
        this.callBack = callBack;
        Intent intent=new Intent(context, CaptureActivity.class);
        context.startActivity(intent);
    }

    public void setOnScanClickListener(OnScanClickListener callBack){
        this.callBack = callBack;
    }

    public OnScanClickListener getCallBack(){
        return this.callBack;
    }

    /**
     * 扫一扫回调数据
     */
    public interface OnScanClickListener {

        void onResult(String bm);
    }
}
